import numpy as np
import torch as pt
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
import sys
import os
from sklearn.preprocessing import StandardScaler

SEED = 1
np.random.seed(SEED)
pt.manual_seed(SEED)

M = 5
y = np.random.randint(0, 2, (M,)).astype(np.float32)  # ATTENTION ndarray.astype
yt = pt.Tensor(y)
print('yt', type(yt), yt)
h = np.random.uniform(0.0, 1.0, (M,))
ht = pt.Tensor(h)
print('ht', type(ht), ht)
compare_yt = yt > 0.5
print('compare_yt', type(compare_yt), compare_yt)
compare_ht = ht > 0.5
print('compare_ht', type(compare_ht), compare_ht)
eq = compare_yt == compare_ht
print('eq', type(eq), eq)
db = eq.double()
print('db', type(db), db)
mean = db.mean()
print('mean', type(mean), mean)
